<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/lottery/js/validate.js"></script>
<link href="/lottery/css/common.css" type="text/css" rel="stylesheet" />
<title>奖品配额</title>
</head>

<body>
<div id="man_zone1">
	
	<table>
		<tr>
			<td>
				<form name="phaseForm" id="phaseForm" action="" method="post">
				每日奖品配额设置, &nbsp;&nbsp;活动:
					<select name="phaseId" id="phaseId" onchange="changePageIndex()">
						<option value="">请选择活动</option>
						<c:forEach var="item" items="${phaseList}">
							<option value="${item.phaseId}">
								${item.phaseName}
							</option>
						</c:forEach>
					</select>
					<SPAN class="button_title"">
						<c:out value="${message}"/>
					</SPAN>
				</form>
			</td>
		</tr>
	</table>
	
	<c:if test="${!empty phase}">
		<table>
			<tr>
				<td>
					当前活动:"
					<SPAN class="button_title"">
					<c:out value="${phase.phaseName}"/>
					</SPAN>",
					活动时间: 
					<fmt:formatDate value="${phase.gmtStart}"/> 至 
					<fmt:formatDate value="${phase.gmtEnd}"/>
					<br/>参与人数: <c:out value="${phase.exceptParticiants}"/>(人),
					<SPAN class="button_title"">
					<c:if test="${flag eq 'notCreateQuota' || flag eq ''}">
						还未创建配额,创建配额之后,就不能修改活动和奖品,
					</c:if>
					<c:if test="${flag eq 'quota'}">
						配额已创建,请更新,
					</c:if>
						中奖概率=奖品配额/参与人数
					</SPAN>
				</td>
			</tr>
		</table>
	</c:if>
	<form action="<c:url value="/admin/prizeQuota.do?action=insertAndUpdate"/>" name="quotaForm" id="quotaForm" method="post" onSubmit="return checkQuotaForm()">
	<input type="hidden" name="flag" id="flag" value="${flag}" >
	<input type="hidden" name="id" id="id" value="${phase.phaseId}" >
<table id="row">
	<thead>
		<tr>
			<th>奖品名称</th>
			<th>奖品等级</th>
			<th>奖品配额</th>
			<th>可用配额</th>
		</tr>
	</thead>
	<tbody>
		<c:set var="i" value="0"/>
		<c:forEach var="item" items="${quotaList}">
		<tr class="even">
			<td width="40%">${item.prizeName}</td>
			<td width="20%">
				<c:if test="${item.prizeLevel eq '1'}">一等奖</c:if>
				<c:if test="${item.prizeLevel eq '2'}">二等奖</c:if>
				<c:if test="${item.prizeLevel eq '3'}">三等奖</c:if>
				<c:if test="${item.prizeLevel eq '4'}">四等奖</c:if>
				<c:if test="${item.prizeLevel eq '5'}">五等奖</c:if>
			</td>
			<td width="20%">
				<input type="hidden" name="prizeId" id="prizeId" value="${item.prizeId}"/>
				<input type="text" name="prizeAmount" id="prizeAmount${i}" value="${item.prizeAmount}" size="10" title="请输入奖品配额"/>
			</td>
			<td width="20%">
				<input type="text" name="avaliableCount" id="avaliableCount${i}" value="${item.avaliableCount}" size="10" title="请输入可用配额"/>
			</td>
		</tr>
		<c:set var="i" value="${i+1}"/>
		</c:forEach>
		
	</tbody>
	<tbody>
	<c:if test="${flag eq 'notCreateQuota'}">
	<tr bgcolor="#FFFFFF">
		<td>&nbsp;</td>
		<td>
		<input type="submit" value="创建"/> 
		&nbsp;
		</td>
	</tr>
	</c:if>
	<c:if test="${flag eq 'quota'}">
	<tr bgcolor="#FFFFFF">
		<td>&nbsp;</td>
		<td>
		<input type="submit" value="更新"/> &nbsp;
		</td>
	</tr>
	</c:if>
	</tbody>
</table>
<input type="hidden" name="count" id="count" value="${i}" >
</form>
</div>
</body>
</html>

